package com.leyou.search.pojo;

import java.util.Map;

/**
 * @author CHERRY
 * @date 2018-09-09-0:57
 */
public class SearchRequest {

    /**
     * 搜索词汇
     */
    private String key;
    /**
     * 当前页
     */
    private Integer page;
    /**
     * 排序字段
     */
    private String sortBy;

    public Boolean getDescending() {
        return descending;
    }

    public void setDescending(Boolean descending) {
        this.descending = descending;
    }

    /**
     * 是否降序
     */
    private Boolean descending;


    /**
     * 默认页面显示数量
     */

    //private static final Integer DEFAULT_SIZE = 20;

    private Integer size;
    /**
     * 默认页码
     */
    private static final Integer DEFAULT_PAGE = 1;

    public Map<String, String> getFilter() {
        return filter;
    }

    public void setFilter(Map<String, String> filter) {
        this.filter = filter;
    }

    /**
     * 过滤规格参数
     */
    private Map<String, String> filter;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Integer getPage() {
        if (page == null) {
            page = DEFAULT_PAGE;
        }
        //获取页码 校验 不小于1
        return Math.max(page, DEFAULT_PAGE);
    }

    public void setPage(Integer page) {

        this.page = page;
    }

    public Integer getSize() {
        return size;
    }

    public void setSize(Integer size) {
        this.size = size;
    }

    public String getSortBy() {
        return sortBy;
    }

    public void setSortBy(String sortBy) {
        this.sortBy = sortBy;
    }


}
